package com.eternal.base.concat;

import com.eternal.base.utils.ByteUtils;

/**
 * Created by Administrator
 * On 2020/5/7
 * Description:
 * @author Administrator
 */
public class DeviceMinModel extends DeviceTFP{
    public byte model;
    public byte[] values=new byte[8];
    public DeviceModelTime time;

    public byte getFan(){
        return values[0];
    }

    public boolean hTmpSwitch(){
        return !ByteUtils.getBit(values[0], 4);
    }

    public boolean lTmpSwitch(){
        return !ByteUtils.getBit(values[0], 5);
    }

    public boolean hHumSwitch(){
        return !ByteUtils.getBit(values[0], 6);
    }

    public boolean lHumSwitch(){
        return !ByteUtils.getBit(values[0], 7);
    }

    public byte getHighTmp(){
        if(isDegree){
            return values[2];
        }
        return values[1];
    }

    public byte getLowTmp(){
        if(isDegree){
            return values[4];
        }
        return values[3];
    }

    public byte getHighHum(){
        return values[5];
    }

    public byte getLowHum(){
        return values[6];
    }

    public char getTime(){
        int num=((values[1]&0xff)<<16)|((values[2]&0xff)<<8)|(values[3]&0xff);
        return (char) (num/60);
    }

    public char getOn(){
        int num=((values[1]&0xff)<<16)|((values[2]&0xff)<<8)|(values[3]&0xff);
        return (char) (num/60);
    }

    public char getOff(){
        int num=((values[5]&0xff)<<16)|((values[6]&0xff)<<8)|(values[7]&0xff);
        return (char) (num/60);
    }

    public char getStart(){
        return (char) (Math.round((values[0]*60+values[1])));
    }

    public char getEnd(){
        return (char) (Math.round((values[2]*60+values[3])));
    }
}
